Listing 10 shows the CreateSamplePathTweenContainer routine, which creates the path tween containers used in Listing 11 through Listing 19 .
Listing 10 Utility routine CreateSamplePathTweenContainer
OSErr CreateSamplePathTweenContainer( QTAtomContainer container,
OSType tweenerType, long whichSamplePath, Boolean returnDelta,
TimeValue duration, Fixed initialRotation, QTAtom *newTweenAtom )
{
OSErr err = noErr;
TimeValue offset;
Handle thePathData = nil;
QTAtom tweenAtom;
err = QTRemoveChildren( container, kParentAtomIsContainer );
if ( err ) goto bail;
offset = 0;
err = AddTweenAtom( container, kParentAtomIsContainer, 1,
tweenerType, offset, duration, 0, 0, nil,
&tweenAtom );
if ( err ) goto bail;
thePathData = CreateSampleVectorData( whichSamplePath );
if ( thePathData == nil ) { err = memFullErr; goto bail; }
HLock( thePathData );
err = AddDataAtom( container, tweenAtom, 1,
GetHandleSize( thePathData ), *thePathData,
nil, 0, nil );
if ( err ) goto bail;
if ( returnDelta ) {
err = AddPathTweenFlags( container, tweenAtom,
kTweenReturnDelta );
}
if ( initialRotation )
QTInsertChild( container, tweenAtom, kInitialRotationAtom,
1, 1, sizeof(initialRotation), &initialRotation, nil );
bail:
if ( thePathData ) DisposeHandle( thePathData );
if ( newTweenAtom ) *newTweenAtom = tweenAtom;
return err;
| Previous | Chapter Contents | Chapter Top | Next |